import 'package:ca_dsp_pro/src/common/bg_chart.dart';
import 'package:ca_dsp_pro/src/common/unit_tool.dart';
import 'package:ca_dsp_pro/src/modules/crossover/cross_item.dart';
import 'package:ca_dsp_pro/src/modules/crossover/my_cross_controller.dart';
import 'package:ca_dsp_pro/src/tool/assets.dart';
import 'package:flutter_kit_dsp/flutter_kit_dsp.dart';

class MyCross extends CrossoverPageDelegate<MyCrossController> {
  MyCross({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Color_bg_view,
      child: Column(
        spacing: 5,
        children: [
          Expanded(child: BgChart()),
          Container(
            padding: EdgeInsets.only(left: 5, right: 5),
            height: 60,
            child: Obx(() {
              final ch = globalController.rxModel.value.current_ch;
              return Row(
                spacing: 5,
                children: List.generate(2, (index) {
                  return CrossItem(pass: index == 0 ? ch.high_pass! : ch.low_pass!);
                }),
              );
            }),
          ),
          SizedBox(
            height: 60,
            child: Obx(() {
              return UnitTool(
                  chlist: globalController.rxModel.value.ch_list,
                  grouplist: controller.groupList,
                  onTouch: (ch) => controller.chooseChInGroup(ch),
                  onLink: (index) => controller.chooseGroup(index));
            }),
          )
        ],
      ),
    );
  }
}
